<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/design/template.xhtml">
  <ui:define name="body">

  <h:form id="frmListReportOrders" prependId="false">
    <p:panel id="pnlListReportOrders" header="Lista pedidos">

      <p:spacer height="10" />
      <p:messages for="frmListReportOrders"/>

      <p:dataTable id="tblReportOrders" value="#{reportAction.reportOrders}" var="reportOrder" style="width:100%;" selectionMode="single"  columnsWidth="15%,15%,10%,20%,20%,20%">

        <p:column style="text-align:center;">
          <f:facet name="header">
            <h:outputText value="Data pagamento" />
          </f:facet>
          <h:outputText value="#{reportOrder.paymentDate eq null ? 'Em aberto' : reportOrder.paymentDate }" >
            <f:convertDateTime pattern="dd/MM/yyyy" />
          </h:outputText>
        </p:column>
        <p:column style="text-align:left;">
          <f:facet name="header">
            <h:outputText value="Situação" />
          </f:facet>
          <h:outputText value="#{reportOrder.pendent ? 'Pendente' : 'Finalizado'}" />
        </p:column>
        <p:column style="text-align:left;">
          <f:facet name="header">
            <h:outputText value="Moeda" />
          </f:facet>
          <h:outputText value="#{reportOrder.currencyType.name}" />
        </p:column>
        <p:column style="text-align:right;">
          <f:facet name="header">
            <h:outputText value="Compra" />
          </f:facet>
          <h:outputText value="#{reportOrder.stringTotalFinalBuyValue}" style="#{reportOrder.paymentDate eq null ? 'color: red;' : ''}"  />
          <f:facet name="footer">
            <h:outputText value="#{reportAction.stringTotalBuy}" />
          </f:facet>
        </p:column>
        <p:column style="text-align:right;">
          <f:facet name="header">
            <h:outputText value="Venda" />
          </f:facet>
          <h:outputText value="#{reportOrder.stringTotalSellValue}" style="#{reportOrder.paymentDate eq null ? 'color: red;' : ''}"  />
          <f:facet name="footer">
            <h:outputText value="#{reportAction.stringTotalSell}" />
          </f:facet>
        </p:column>
        <p:column style="text-align:right;">
          <f:facet name="header">
            <h:outputText value="Lucro" />
          </f:facet>
          <h:outputText value="#{reportOrder.stringTotalGainValue}" style="#{reportOrder.paymentDate eq null ? 'color: red;' : ''}"  />
          <f:facet name="footer">
            <h:outputText value="#{reportAction.stringTotalGain}" />
          </f:facet>
        </p:column>
      </p:dataTable>

    </p:panel>
  </h:form>

  </ui:define>
</ui:composition>

